package schoolWork.Test7;

import java.util.Scanner;

class TestPrimeSum {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        int sum = PrimeSum.primeSum(n);
        System.out.println(sum);
    }
}

public class PrimeSum {
    public static int primeSum(int n) {
        int sum = 0;
        int cnt = 0;
        int i = 2;
        while (cnt != n) {
            if (isprime(i)) {
                cnt++;
                sum += i;
            }
            i++;
        }
        return sum;
    }

    public static boolean isprime(int i) {
        for (int j = 2; j < i; j++) {
            if (i % j == 0)
                return false;
        }
        return true;
    }
}
